Skip to content

Disable ServerTelemetryManager by default#8600

Open
tnorling wants to merge 7 commits into
devfrom
disable-serverTelemetry
Open

Disable ServerTelemetryManager by default#8600
tnorling wants to merge 7 commits into
devfrom
disable-serverTelemetry

Conversation

@tnorling
Copy link
Copy Markdown
Collaborator

This pull request introduces a new configuration option, serverTelemetryEnabled, to the MSAL Browser library, allowing developers to enable or disable server telemetry headers and caching of failed requests. The option is added with a default value of false and is marked as deprecated for future removal. The PR updates the configuration logic, documentation, and all interaction clients to respect this flag, and adds tests to verify correct behavior.

Configuration and API changes:

  • Added the serverTelemetryEnabled option to BrowserSystemOptions in both the API and implementation, with a default value of false and marked as deprecated for future removal. This controls whether MSER server telemetry headers are sent and failed requests are cached. [1] [2] [3]

  • Updated the documentation (configuration.md) to describe the new serverTelemetryEnabled option, its default value, and its effect. Also updated example configuration usage. [1] [2]

Code updates for telemetry behavior:

  • Modified the initializeServerTelemetryManager function to accept an enabled parameter, defaulting to true, and return a stub manager when telemetry is disabled. Updated all interaction clients (PopupClient, RedirectClient, SilentAuthCodeClient, SilentCacheClient, SilentIframeClient, SilentRefreshClient, PlatformAuthInteractionClient) to pass the new flag from configuration. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]

Testing and validation:

  • Added and updated unit tests to verify the default value of serverTelemetryEnabled, its behavior when set to true, and that telemetry data is written to storage only when enabled. [1] [2] [3] [4]

API review and type updates:

  • Updated API review files and error comments to reflect the changes in configuration and internal types.

Configuration changes:

  • Added serverTelemetryEnabled (default false, deprecated) to BrowserSystemOptions and configuration builder, controlling whether server telemetry headers are sent and failed requests are cached. [1] [2] [3]
  • Updated documentation and example usage to include and explain serverTelemetryEnabled. [1] [2]

Telemetry manager updates:

Testing:

  • Added and updated unit tests to verify default and explicit values of serverTelemetryEnabled, and that telemetry is written to storage only when enabled. [1] [2] [3] [4]

API review:

  • Updated API review files and comments to reflect new configuration and type changes.

Copilot AI review requested due to automatic review settings May 21, 2026 20:32
@tnorling tnorling requested a review from a team as a code owner May 21, 2026 20:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates MSAL Browser to support disabling MSER server telemetry by default via a new system.serverTelemetryEnabled configuration flag (default false), and wires that flag through the interaction clients, docs, and tests.

Changes:

  • Adds serverTelemetryEnabled to BrowserSystemOptions with a default of false, and updates interaction clients to pass the flag when initializing server telemetry.
  • Introduces a stub telemetry manager and wraps telemetry cache writes to avoid breaking auth flows if telemetry caching fails.
  • Updates documentation, API review files, changefiles, and unit tests to reflect/verify the new default behavior.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
lib/msal-common/src/telemetry/server/ServerTelemetryManager.ts Wraps cacheFailedRequest in try/catch and adds StubServerTelemetryManager.
lib/msal-common/src/exports-common.ts Exports StubServerTelemetryManager from the msal-common entrypoint.
lib/msal-common/apiReview/msal-common.api.md Updates API review output to include the stub telemetry manager (and a new warning).
lib/msal-browser/src/interaction_client/BaseInteractionClient.ts Adds enabled parameter to initializeServerTelemetryManager and returns stub when disabled.
lib/msal-browser/src/interaction_client/PopupClient.ts Passes serverTelemetryEnabled into telemetry manager initialization.
lib/msal-browser/src/interaction_client/RedirectClient.ts Passes serverTelemetryEnabled into telemetry manager initialization.
lib/msal-browser/src/interaction_client/SilentAuthCodeClient.ts Passes serverTelemetryEnabled into telemetry manager initialization.
lib/msal-browser/src/interaction_client/SilentCacheClient.ts Passes serverTelemetryEnabled into telemetry manager initialization.
lib/msal-browser/src/interaction_client/SilentIframeClient.ts Passes serverTelemetryEnabled into telemetry manager initialization.
lib/msal-browser/src/interaction_client/SilentRefreshClient.ts Passes serverTelemetryEnabled into telemetry manager initialization.
lib/msal-browser/src/interaction_client/PlatformAuthInteractionClient.ts Passes serverTelemetryEnabled into telemetry manager initialization.
lib/msal-browser/src/config/Configuration.ts Adds serverTelemetryEnabled to BrowserSystemOptions and sets default to false.
lib/msal-browser/docs/configuration.md Documents the new serverTelemetryEnabled option and updates sample config.
lib/msal-browser/apiReview/msal-browser.api.md Updates API review to include serverTelemetryEnabled in BrowserSystemOptions.
lib/msal-browser/test/config/Configuration.spec.ts Adds unit tests verifying serverTelemetryEnabled default and explicit true value.
lib/msal-browser/test/app/PublicClientApplication.spec.ts Updates tests to enable server telemetry when asserting cache writes.
lib/msal-browser/test/interaction_client/PopupClient.spec.ts Updates tests to enable server telemetry when asserting cache writes.
lib/msal-browser/test/interaction_client/RedirectClient.spec.ts Updates tests to enable server telemetry when asserting cache writes.
lib/msal-browser/test/interaction_client/SilentIframeClient.spec.ts Updates tests to enable server telemetry when asserting cache writes.
lib/msal-browser/test/interaction_client/PlatformAuthInteractionClient.spec.ts Updates tests to enable server telemetry when asserting cache writes.
change/@azure-msal-common-ac7e7225-f5ff-4376-a86b-b6989215c195.json Adds changefile for msal-common.
change/@azure-msal-browser-0c5b4f43-6dec-40eb-8a4d-60a63666c744.json Adds changefile for msal-browser.

Comment thread lib/msal-browser/src/interaction_client/BaseInteractionClient.ts
Comment thread lib/msal-common/src/exports-common.ts
Comment thread lib/msal-common/apiReview/msal-common.api.md
Comment thread lib/msal-browser/docs/configuration.md Outdated
Comment thread change/@azure-msal-common-ac7e7225-f5ff-4376-a86b-b6989215c195.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants